import java.util.*;

public class _06_CountSpecifiedWord {
	
	public static void main(String[] args) {
		
		Scanner in = new Scanner(System.in);
		String input = in.nextLine();
		String word = in.nextLine();
		in.close();
		
		String[] splittedText = input.split("\\W");
		int wordFrequency = 0;
		
		for (int i = 0; i < splittedText.length; i++) {
			
			if (splittedText[i].toLowerCase().equals(word.toLowerCase())) {
				
				wordFrequency++;
			}
		}
		
		System.out.println(wordFrequency);
	}
}